﻿using Magicodes.ExporterAndImporter.Excel.AspNetCore;
using Microsoft.AspNetCore.Mvc;
using NP.BPMReportPlatform.Reports.CBBYS.Dtos;
using NP.BPMReportPlatform.Reports.CXYXTHNRA.Dtos;
using NP.BPMReportPlatform.Reports.DailyCloseBook.Dtos;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Volo.Abp.Application.Dtos;

namespace NP.BPMReportPlatform.Reports.CBBYS
{
    //[Authorize]
    [ApiController]
    [Route("api/Reports/CBBYS")]
    public class CBBYSController : BPMReportPlatformController
    {
        private readonly ICBBYSService _service;
        public CBBYSController(ICBBYSService service)
        {
            _service = service;
        }


        /// <summary>
        /// 查询数据
        /// </summary>
        /// <param name="input"></param>
        /// <returns></returns>
        [HttpPost]
        [Route("GetAllAsync")]
        public async Task<PagedResultDto<GetCBBYSOutput>> GetAllAsync([FromBody] GetCBBYSInput input)
        {
            return await _service.GetAllAsync(input);
        }

        /// <summary>
        /// 导出数据
        /// </summary>
        /// <param name="input"></param>
        /// <returns></returns>
        [HttpPost]
        [Route("ExportExcel")]
        public async Task<XlsxFileResult<GetCBBYSOutput>> ExportExcel([FromBody] GetCBBYSInput input)
        {
            var rst = await _service.ExportAsync(input);
            return new XlsxFileResult<GetCBBYSOutput>(rst, "导出Excel");
        }
    }
}
